#ifndef _E_CHARACTER_H_
#define _E_CHARACTER_H_

#include "EEntity.h"
#include "EVector.h"
#include "EDesc.h"
#include "EPhCharacter.h"
#include "eH.h"

namespace engine
{

//------------------------------------------------------------
class ECharacterDesc : public EPhCharacterDesc
{
public:
  ECharacterDesc();
  string      m_sModelFileName;

  float       m_fRunMinWantedMovingSpeed;
  float       m_fWalkMinWantedMovingSpeed;
  float       m_fRunMovingSpeed;
  float       m_fWalkMovingSpeed;

  bool      isValid() const;
};

//------------------------------------------------------------

class ECharacter : public EEntity, public EPhCharacter
{
  friend class EScene;

  ECharacterDesc      m_Desc;
  EVector             m_vMovingDirection;
  float               m_fMovingSpeed;
  EVector             m_vWantedMovingDirection;
  float               m_fWantedMovingSpeed;
  bool                m_bIsMovingRequested;
  bool                m_bAnimationNotFinished;
  float               m_fYaw;
  float               m_fRequestedYaw;
  
protected:

  ECharacter( const string& sName, const ECharacterDesc& desc );

public:

          void                move              ( const EVector& vNormalizedDirection, float fSpeed );
          void                updateMove        ( const EGameTime& time );
          void                stopMoving        ();
          void                tryIfTheMovingAnimationHasEnded();
          void                faceDirection     ( const EVector& vDirection );
          void                updateFacingDirection(const EGameTime& time );
  virtual bool                update            ( const EGameTime& time );
  virtual bool                startGame         ( );
  virtual bool                updateGame        ( const EGameTime& time );
  virtual bool                endGame           ( );
};

} // end namespace

#endif